package com.whm.hrmanagement.mapper;

import java.util.List;


import com.whm.hrmanagement.domain.OaInsurance;
import com.whm.hrmanagement.domain.dto.OaStaffSalaryDto;
import com.whm.hrmanagement.domain.dto.StaffInsuranceDto;
import com.whm.hrmanagement.domain.vo.OaInsuranceVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 员工五险一金Mapper接口
 * 
 * @author whm
 * @date 2024-02-09
 */
public interface OaInsuranceMapper 
{





    @Select("select ss.user_id staffId,ss.nick_name name,ss.phonenumber phone,sd.dept_name dept_name," +
            "si.id  insuranceId,si.city_id cityId,si.social_base socialBase,si.per_social_pay perSocialPay,si.com_injury_rate  comInjuryRate,si.com_social_pay comSocialPay,si.social_remark socialRemark,si.house_base houseBase,si.per_house_rate perHouseRate," +
            "si.per_house_pay perHousePay,si.com_house_rate comHouseRate,si.com_house_pay comHousePay,si.house_remark houseRemark,si.status from " +
            "(sys_user ss left join sys_dept sd on ss.dept_id = sd.dept_id) left join oa_insurance si on si.staff_id = ss.user_id " +
            "where ss.del_flag = 0 and ss.dept_id = #{deptId} and ss.nick_name like concat('%',#{name},'%')")
    public  List<StaffInsuranceDto> listStaffDeptInsuranceVO(@Param("name") String name, @Param("deptId") Long deptId);

    @Select("select ss.user_id staffId,ss.nick_name name,ss.phonenumber phone,sd.dept_name dept_name," +
            "si.id insuranceId,si.city_id cityId,si.social_base socialBase,si.per_social_pay perSocialPay,si.com_injury_rate  comInjuryRate,si.com_social_pay comSocialPay,si.social_remark socialRemark,si.house_base houseBase,si.per_house_rate perHouseRate," +
            "si.per_house_pay perHousePay,si.com_house_rate comHouseRate,si.com_house_pay comHousePay,si.house_remark houseRemark,si.status from " +
            "(sys_user ss left join sys_dept sd on ss.dept_id = sd.dept_id) left join oa_insurance si on si.staff_id = ss.user_id " +
                    "where ss.del_flag = 0 and ss.nick_name like concat('%',#{name},'%')")
    public  List<StaffInsuranceDto> listStaffInsuranceVO(@Param("name") String name);


    @Select("select ss.user_id staffId,ss.nick_name name,ss.phonenumber phone,sd.dept_name dept_name," +
            "si.id insuranceId,si.city_id cityId,si.social_base socialBase,si.per_social_pay perSocialPay,si.com_injury_rate  comInjuryRate,si.com_social_pay comSocialPay,si.social_remark socialRemark,si.house_base houseBase,si.per_house_rate perHouseRate," +
            "si.per_house_pay perHousePay,si.com_house_rate comHouseRate,si.com_house_pay comHousePay,si.house_remark houseRemark,si.status from " +
            "(sys_user ss left join sys_dept sd on ss.dept_id = sd.dept_id) left join oa_insurance si on si.staff_id = ss.user_id " +
            "where ss.del_flag = 0")
    List<StaffInsuranceDto>  findStaffInsuranceVO();









    /**
     * 查询员工五险一金
     * 
     * @param id 员工五险一金主键
     * @return 员工五险一金
     */
    public OaInsurance selectOaInsuranceById(String id);
    public OaInsurance getInsuranceByStaffId(String id);

    /**
     * 查询员工五险一金列表
     * 
     * @param oaInsurance 员工五险一金
     * @return 员工五险一金集合
     */
    public List<OaInsurance> selectOaInsuranceList(OaInsurance oaInsurance);

    /**
     * 新增员工五险一金
     * 
     * @param oaInsurance 员工五险一金
     * @return 结果
     */
    public int insertOaInsurance(OaInsurance oaInsurance);

    /**
     * 修改员工五险一金
     * 
     * @param oaInsurance 员工五险一金
     * @return 结果
     */
    public int updateOaInsurance(OaInsurance oaInsurance);

    /**
     * 删除员工五险一金
     * 
     * @param id 员工五险一金主键
     * @return 结果
     */
    public int deleteOaInsuranceById(String id);

    /**
     * 批量删除员工五险一金
     * 
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteOaInsuranceByIds(String[] ids);
}
